home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / syslog.man < prev    next >
Encoding:
Text File  |  1989-01-02  |  5.9 KB  |  199 lines

  1.  
  2.  
  3.  
  4. SYSLOG                C Library Procedures                 SYSLOG
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      syslog, openlog, closelog, setlogmask - control system log
  10.  
  11. SSYYNNOOPPSSIISS
  12.      ##iinncclluuddee <<ssyysslloogg..hh>>
  13.  
  14.      ooppeennlloogg((iiddeenntt,, llooggoopptt,, ffaacciilliittyy))
  15.      cchhaarr **iiddeenntt;;
  16.  
  17.      ssyysslloogg((pprriioorriittyy,, mmeessssaaggee,, ppaarraammeetteerrss ...... ))
  18.      cchhaarr **mmeessssaaggee;;
  19.  
  20.      cclloosseelloogg(())
  21.  
  22.      sseettllooggmmaasskk((mmaasskkpprrii))
  23.  
  24. DDEESSCCRRIIPPTTIIOONN
  25.      _S_y_s_l_o_g arranges to write _m_e_s_s_a_g_e onto the system log main-
  26.      tained by _s_y_s_l_o_g_d(8).  The message is tagged with _p_r_i_o_r_i_t_y.
  27.      The message looks like a _p_r_i_n_t_f(3) string except that %%mm is
  28.      replaced by the current error message (collected from
  29.      _e_r_r_n_o).  A trailing newline is added if needed.  This mes-
  30.      sage will be read by _s_y_s_l_o_g_d(8) and written to the system
  31.      console, log files, or forwarded to _s_y_s_l_o_g_d on another host
  32.      as appropriate.
  33.  
  34.      Priorities are encoded as a _f_a_c_i_l_i_t_y and a _l_e_v_e_l.  The
  35.      facility describes the part of the system generating the
  36.      message.  The level is selected from an ordered list:
  37.  
  38.      LOG_EMERG     A panic condition.  This is normally broadcast
  39.                    to all users.
  40.  
  41.      LOG_ALERT     A condition that should be corrected immedi-
  42.                    ately, such as a corrupted system database.
  43.  
  44.      LOG_CRIT      Critical conditions, e.g., hard device errors.
  45.  
  46.      LOG_ERR       Errors.
  47.  
  48.      LOG_WARNING   Warning messages.
  49.  
  50.      LOG_NOTICE    Conditions that are not error conditions, but
  51.                    should possibly be handled specially.
  52.  
  53.      LOG_INFO      Informational messages.
  54.  
  55.      LOG_DEBUG     Messages that contain information normally of
  56.                    use only when debugging a program.
  57.  
  58.      If _s_y_s_l_o_g cannot pass the message to _s_y_s_l_o_g_d, it will
  59.      attempt to write the message on /_d_e_v/_c_o_n_s_o_l_e if the LOG_CONS
  60.  
  61.  
  62.  
  63. Sprite v1.0               May 15, 1986                          1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. SYSLOG                C Library Procedures                 SYSLOG
  71.  
  72.  
  73.  
  74.      option is set (see below).
  75.  
  76.      If special processing is needed, _o_p_e_n_l_o_g can be called to
  77.      initialize the log file.  The parameter _i_d_e_n_t is a string
  78.      that is prepended to every message.  _L_o_g_o_p_t is a bit field
  79.      indicating logging options.  Current values for _l_o_g_o_p_t are:
  80.  
  81.      LOG_PID       log the process id with each message: useful
  82.                    for identifying instantiations of daemons.
  83.  
  84.      LOG_CONS      Force writing messages to the console if
  85.                    unable to send it to _s_y_s_l_o_g_d. This option is
  86.                    safe to use in daemon processes that have no
  87.                    controlling terminal since _s_y_s_l_o_g will fork
  88.                    before opening the console.
  89.  
  90.      LOG_NDELAY    Open the connection to _s_y_s_l_o_g_d immediately.
  91.                    Normally the open is delayed until the first
  92.                    message is logged.  Useful for programs that
  93.                    need to manage the order in which file
  94.                    descriptors are allocated.
  95.  
  96.      LOG_NOWAIT    Don't wait for children forked to log messages
  97.                    on the console.  This option should be used by
  98.                    processes that enable notification of child
  99.                    termination via SIGCHLD, as _s_y_s_l_o_g may other-
  100.                    wise block waiting for a child whose exit
  101.                    status has already been collected.
  102.  
  103.      The _f_a_c_i_l_i_t_y parameter encodes a default facility to be
  104.      assigned to all messages that do not have an explicit facil-
  105.      ity encoded:
  106.  
  107.      LOG_KERN      Messages generated by the kernel.  These can-
  108.                    not be generated by any user processes.
  109.  
  110.      LOG_USER      Messages generated by random user processes.
  111.                    This is the default facility identifier if
  112.                    none is specified.
  113.  
  114.      LOG_MAIL      The mail system.
  115.  
  116.      LOG_DAEMON    System daemons, such as _f_t_p_d(8), _r_o_u_t_e_d(8),
  117.                    etc.
  118.  
  119.      LOG_AUTH      The authorization system: _l_o_g_i_n(1), _s_u(1),
  120.                    _g_e_t_t_y(8), etc.
  121.  
  122.      LOG_LPR       The line printer spooling system: _l_p_r(1),
  123.                    _l_p_c(8), _l_p_d(8), etc.
  124.  
  125.      LOG_LOCAL0    Reserved for local use.  Similarly for
  126.  
  127.  
  128.  
  129. Sprite v1.0               May 15, 1986                          2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. SYSLOG                C Library Procedures                 SYSLOG
  137.  
  138.  
  139.  
  140.                    LOG_LOCAL1 through LOG_LOCAL7.
  141.  
  142.      _C_l_o_s_e_l_o_g can be used to close the log file.
  143.  
  144.      _S_e_t_l_o_g_m_a_s_k sets the log priority mask to _m_a_s_k_p_r_i and returns
  145.      the previous mask.  Calls to _s_y_s_l_o_g with a priority not set
  146.      in _m_a_s_k_p_r_i are rejected.  The mask for an individual prior-
  147.      ity _p_r_i is calculated by the macro LOG_MASK(_p_r_i); the mask
  148.      for all priorities up to and including _t_o_p_p_r_i is given by
  149.      the macro LOG_UPTO(_t_o_p_p_r_i).  The default allows all priori-
  150.      ties to be logged.
  151.  
  152. EEXXAAMMPPLLEESS
  153.      syslog(LOG_ALERT, "who: internal error 23");
  154.  
  155.      openlog("ftpd", LOG_PID, LOG_DAEMON);
  156.      setlogmask(LOG_UPTO(LOG_ERR));
  157.      syslog(LOG_INFO, "Connection from host %d", CallingHost);
  158.  
  159.      syslog(LOG_INFO|LOG_LOCAL2, "foobar error: %m");
  160.  
  161. SSEEEE AALLSSOO
  162.      logger(1), syslogd(8)
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195. Sprite v1.0               May 15, 1986                          3
  196.  
  197.  
  198.  
  199.